package com.arpa.ntocc.common.domain.vo;

import com.arpa.ntocc.common.domain.enums.SystemEnum;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.io.Serializable;
import java.util.List;


/**
 * 前台vue对应菜单
 * @Author liuyj
 * @Date 2020-02-18 15:06:48
 */
@Data
public class ResourceVueVO implements Serializable {

    @ApiModelProperty(value = "资源标识")
    private String code;

    @ApiModelProperty(value = "上级资源标识")
    private String parentCode;

    @ApiModelProperty(value = "资源层级")
    private Integer level;

    @ApiModelProperty(value = "资源名称")
    private String name;

    @ApiModelProperty(value = "资源权限")
    private String permission;

    @ApiModelProperty(value = "跳转")
    private String redirect;

    @ApiModelProperty(value = "资源url")
    private String path;

    @ApiModelProperty(value = "vue组件路径")
    private String component;

    @ApiModelProperty(value = "排序")
    private Integer sort;

    @ApiModelProperty(value = "meta")
    private Meta meta;

    @ApiModelProperty(value = "所属系统")
    private SystemEnum belong;

    @ApiModelProperty(value = "机构code")
    private String branchCode;

    @ApiModelProperty(value = "是否隐藏路由")
    private boolean hidden;

    @ApiModelProperty(value = "下级资源")
    private List<ResourceVueVO> children;

    /**
     * 为了给前台vue拼装数据个数的内部类
     */
    @Data
    public class Meta implements Serializable {

        @ApiModelProperty(value = "菜单名")
        private String title;

        @ApiModelProperty(value = "图标")
        private String icon;

        @ApiModelProperty(value = "是否使用缓存，使用缓存则页面切换回来原来操作的数据还在，默认为true，表示不使用缓存；")
        private boolean noCache;

    }

    public void setMeta(String title,String icon,boolean noCache) {
        this.meta = new Meta();
        this.meta.setTitle(title);
        this.meta.setIcon(icon);
        this.meta.setNoCache(noCache);

    }
}
